package com.ibm.moa.outmail;

import java.util.ArrayList;
import java.util.HashMap;

import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Paint;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.text.TextPaint;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.webkit.WebSettings;
import android.webkit.WebSettings.LayoutAlgorithm;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.ibm.moa.outmail.module.MailInfo;
import com.ibm.moa.outmail.net.HttpManage;
import com.ibm.moa.outmail.net.HttpRequestListener;
import com.ibm.moa.outmail.utils.DBHandler;
import com.ibm.moa.outmail.utils.DensityUtil;
import com.ibm.moa.outmail.utils.FileUtil;
import com.ibm.moa.outmail.utils.ParserRequest;
import com.ibm.moa.outmail.utils.UIEventListener;
import com.ibm.moa.outmail.utils.Utils;
import com.ibm.moa.outmail.view.MessageWebView;

@SuppressWarnings("deprecation")
public class MailInfoActivity extends BaseActivity implements OnClickListener, HttpRequestListener {
	private ImageView moreOperateBT;
	private ImageView backIV;
	private Dialog dialog;
	private TextView subject, from, sendDate, mailCc, mailBcc;
	private MessageWebView content;
	// 抄送和密送显示的控制
	private LinearLayout llMailcc, llMailbcc;

	// 发送人
	private LinearLayout llSender;

	// 收件人
	private LinearLayout llReceiver;

	private LinearLayout contentLayout;
	private MailInfo mailInfo;

	// 附件数量
	private TextView fujianNum;

	// 附件显示的条目
	private RelativeLayout fujianItem;

	// 附件
	private LinearLayout fujianSwitch, fujianContent;
	private ImageView fujianArrow;

	// 显示详情
	private TextView showDetail;

	private RelativeLayout ivMailDelete, ivMailReply, ivMailTransmit, ivMailReplyAll;
	private ImageView zoomDownIv, zoomUpIv;

	@SuppressLint("HandlerLeak")
	@SuppressWarnings("unchecked")
	private Handler handler = new Handler() {
		@SuppressLint("SetJavaScriptEnabled")
		public void handleMessage(Message msg) {
			if (dialog != null && dialog.isShowing()) {
				dialog.dismiss();
			}
			switch (msg.what) {
			case UIEventListener.EVENT_GET_DATA_SUCCESS:
				HashMap<String, Object> map = (HashMap<String, Object>) msg.obj;
				if (map != null) {
					if ("1".equals(map.get("req_code"))) {
						mailInfo = (MailInfo) map.get("mailInfo");
						if (mailInfo != null) {
							showData();
						}
					} else {
						Toast.makeText(MailInfoActivity.this, (String) map.get("req_mess") == null ? "返回信息错误" : (map.get("req_mess") + ""),
								Toast.LENGTH_SHORT).show();
					}
				}
				break;
			case UIEventListener.EVENT_GET_DATA_FAILURE:
				Toast.makeText(MailInfoActivity.this, (String) msg.obj, Toast.LENGTH_SHORT).show();
				break;
			case UIEventListener.EVENT_DELETE_RECEIVE_MAIL_SUCCESS:
				HashMap<String, Object> mapDelete = (HashMap<String, Object>) msg.obj;
				if (mapDelete != null) {
					if ("1".equals(mapDelete.get("req_code"))) {
						Toast.makeText(MailInfoActivity.this, (String) mapDelete.get("req_mess") == null ? "删除成功" : (mapDelete.get("req_mess") + ""),
								Toast.LENGTH_SHORT).show();
						Intent intent = new Intent();
						intent.putExtra("mailId", mailInfo.mailId);
						intent.putExtra("timeMillis", mailInfo.timeMillis);
						MailInfoActivity.this.setResult(RESULT_OK, intent);
						finish();
					} else {
						Toast.makeText(MailInfoActivity.this,
								(String) mapDelete.get("req_mess") == null ? "返回信息错误" : (mapDelete.get("req_mess") + ""), Toast.LENGTH_SHORT).show();
					}
				}
				break;
			case UIEventListener.EVENT_DELETE_RECEIVE_MAIL_FAILURE:
				Toast.makeText(MailInfoActivity.this, (String) msg.obj, Toast.LENGTH_SHORT).show();
				break;
			case 24:// 附件下载
				HashMap<String, String> fujianMap = (HashMap<String, String>) msg.obj;
				if ("1".equals(fujianMap.get("req_code"))) {
					String file_name = fujianMap.get("file_name");
					String file_path = fujianMap.get("file_path");
					if (file_path == null) {
						Toast.makeText(MailInfoActivity.this, "下载地址有误", Toast.LENGTH_SHORT).show();
						return;
					}
					if (file_name == null) {
						Toast.makeText(MailInfoActivity.this, "返回的文件名有误", Toast.LENGTH_SHORT).show();
						return;
					}
					if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
						// DownLoadDBTask downLoadApk = new DownLoadDBTask(
						// MailInfoActivity.this);
						// downLoadApk.execute(file_path, file_name);
						Toast.makeText(MailInfoActivity.this, "文件已下载，保存在  " + file_path, Toast.LENGTH_SHORT).show();
						FileUtil.openFile(getApplicationContext(), file_path);
					} else {
						Toast.makeText(MailInfoActivity.this, "请先插入SD卡", Toast.LENGTH_LONG).show();
					}
				} else {
					Toast.makeText(MailInfoActivity.this, (String) fujianMap.get("req_mess") == null ? "返回信息错误" : (fujianMap.get("req_mess") + ""),
							Toast.LENGTH_SHORT).show();
				}
				break;
			default:
				break;
			}
		}
	};

	/**
	 * 初始化附件
	 */
	private void initFujian() {
		fujianSwitch.setVisibility(View.VISIBLE);
		fujianNum.setText("" + mailInfo.attachments.size());
		LinearLayout fujianView;
		TextView fujianName;
		ImageView fujianIcon;
		fujianContent.setVisibility(View.GONE);
		for (int i = 0; i < mailInfo.attachments.size(); i++) {
			final String fujianStr = (String) mailInfo.attachments.get(i);
			fujianView = (LinearLayout) View.inflate(MailInfoActivity.this, R.layout.fujian_item, null);
			fujianName = (TextView) fujianView.findViewById(R.id.fujian_filename);
			fujianIcon = (ImageView) fujianView.findViewById(R.id.fujian_icon);
			fujianName.setText(fujianStr);
			Utils.setFujianIcon(fujianIcon, fujianStr);
			fujianView.setOnClickListener(new OnClickListener() {
				@Override
				public void onClick(View v) {
					getFujianInfo(fujianStr);
				}
			});

			// 添加分割线
			if (i > 0) {
				ImageView ivDevide = new ImageView(MailInfoActivity.this);
				ivDevide.setBackgroundResource(R.drawable.listview_divider);

				fujianContent.addView(ivDevide);

				LayoutParams params = ivDevide.getLayoutParams();
				params.width = LayoutParams.FILL_PARENT;
				params.height = DensityUtil.dip2px(MailInfoActivity.this, 1);
				ivDevide.setLayoutParams(params);
			}

			fujianContent.addView(fujianView);

		}
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.mail_info);

		// 初始化View
		initView();

		// 初始化监听器
		initListener();

		// 为文本添加下划线
		showDetail.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);

		// 填充数据
		fillData();
	}

	/**
	 * 初始化View
	 */
	private void initView() {
		// 初始化View
		backIV = (ImageView) findViewById(R.id.home_back_iv);
		moreOperateBT = (ImageView) findViewById(R.id.mail_info_more_operate);
		subject = (TextView) findViewById(R.id.mail_info_subject);
		showDetail = (TextView) findViewById(R.id.mail_info_detail);
		from = (TextView) findViewById(R.id.mail_info_from);
		llSender = (LinearLayout) findViewById(R.id.mail_info_receiver);
		llReceiver = (LinearLayout) findViewById(R.id.ll_receiver);
		llMailcc = (LinearLayout) findViewById(R.id.ll_mail_info_mailcc);
		mailCc = (TextView) findViewById(R.id.mail_info_mailcc);
		llMailbcc = (LinearLayout) findViewById(R.id.ll_mail_info_mailbcc);
		mailBcc = (TextView) findViewById(R.id.mail_info_mailbcc);
		sendDate = (TextView) findViewById(R.id.mail_info_dateTime);
		fujianSwitch = (LinearLayout) findViewById(R.id.ll_mail_info_fujian_switch);
		fujianItem = (RelativeLayout) findViewById(R.id.rl_mail_info_fujian_item);
		fujianNum = (TextView) findViewById(R.id.tv_fujian_num);
		fujianArrow = (ImageView) findViewById(R.id.img_mail_info_fujian_arrow);
		fujianContent = (LinearLayout) findViewById(R.id.ll_mail_info_fujian_content);
		contentLayout = (LinearLayout) findViewById(R.id.webview_layout);
		zoomDownIv = (ImageView) findViewById(R.id.zoom_down_iv);
		zoomUpIv = (ImageView) findViewById(R.id.zoom_up_iv);

		ivMailDelete = (RelativeLayout) findViewById(R.id.iv_mail_info_delete);
		ivMailReply = (RelativeLayout) findViewById(R.id.iv_mail_info_reply);
		ivMailTransmit = (RelativeLayout) findViewById(R.id.iv_mail_info_transmit);
		ivMailReplyAll = (RelativeLayout) findViewById(R.id.iv_mail_info_reply_all);
	}

	/**
	 * 初始化监听器
	 */
	private void initListener() {
		zoomDownIv.setOnClickListener(this);
		zoomUpIv.setOnClickListener(this);
		moreOperateBT.setOnClickListener(this);
		backIV.setOnClickListener(this);
		showDetail.setOnClickListener(this);

		ivMailDelete.setOnClickListener(this);
		ivMailReply.setOnClickListener(this);
		ivMailTransmit.setOnClickListener(this);
		ivMailReplyAll.setOnClickListener(this);

		fujianItem.setOnClickListener(this);
	}

	/**
	 * 填充数据
	 */
	@SuppressLint("SetJavaScriptEnabled")
	private void fillData() {
		if (getIntent().getSerializableExtra("mailInfo") != null) {
			mailInfo = (MailInfo) getIntent().getSerializableExtra("mailInfo");
			// menuReplyBT.setVisibility(View.GONE);
			// menuReplyAllBT.setVisibility(View.GONE);
			// menuForwardBT.setVisibility(View.GONE);
			if (mailInfo != null) {
				showData();
			} else {
				Toast.makeText(this, "信息有误！", Toast.LENGTH_SHORT).show();
				findViewById(R.id.zoom_layout).setVisibility(View.GONE);
			}
		} else {
			getMailInfoRequest();
		}
	}

	/**
	 * 显示数据
	 */
	@SuppressLint("SetJavaScriptEnabled")
	private void showData() {
		subject.setText(mailInfo.subject);
		TextPaint tp = subject.getPaint();
		tp.setFakeBoldText(true);
		// content.setText(Html.fromHtml(mailInfo.plainContent));

		// 填写发件人并为其设置背景
		if (!TextUtils.isEmpty(mailInfo.mailUserId)) {
			from.setText(mailInfo.mailUserId);
		} else {
			from.setText(mailInfo.from);
		}
		from.setBackgroundResource(R.drawable.sender_name_bg);

		sendDate.setText(mailInfo.sendDate);

		// 收件人显示
		if (!TextUtils.isEmpty(mailInfo.recAddr)) {
			llSender.addView(Utils.getView(this, mailInfo.recAddr.split(";")));
		}

		if (!TextUtils.isEmpty(mailInfo.mailCc)) {
			mailCc.setText(mailInfo.mailCc);
		}
		if (!TextUtils.isEmpty(mailInfo.mailBcc)) {
			mailBcc.setText(mailInfo.mailBcc);
		}

		content = new MessageWebView(MailInfoActivity.this);
		content.setTag("webview");
		LinearLayout.LayoutParams ll = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT);
		contentLayout.removeAllViews();
		contentLayout.addView(content, ll);
		content.getSettings().setJavaScriptEnabled(true);
		content.getSettings().setDefaultTextEncodingName("UTF-8");
		content.getSettings().setLayoutAlgorithm(LayoutAlgorithm.NARROW_COLUMNS);
		content.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
		content.getSettings().setTextSize(WebSettings.TextSize.NORMAL);
		// content.loadDataWithBaseURL("about:blank", mailInfo.plainContent + "</br></p>" + mailInfo.preContent + "</br></br>", "text/html", "UTF-8",
		// null);
		content.setText(mailInfo.plainContent + "</br></p>" + mailInfo.preContent + "</br></br>");
		handler.postDelayed(wvr, 100);

		if (mailInfo.attachments.size() > 0) {
			initFujian();
		}
		if ("".equals(mailInfo.plainContent) && "".equals(mailInfo.preContent)) {
			findViewById(R.id.zoom_layout).setVisibility(View.GONE);
		}
	}

	private void getMailInfoRequest() {
		HashMap<String, String> map = new HashMap<String, String>();
		map.put("invoke", "getImailDetail");
		map.put("userCode", MailApplication.userCode);
		map.put("password", MailApplication.passWord);
		map.put("imailId", getIntent().getStringExtra("mailId"));
		new HttpManage(MailInfoActivity.this, MailInfoActivity.this, map, 1);
		dialog = Utils.createProgressDialog(this, Utils.getLoadingMessage(MailInfoActivity.this, "加载中..."));
		dialog.show();
	}

	@SuppressLint("SetJavaScriptEnabled")
	@Override
	public void onClick(View v) {
		if (v == backIV) {
			finish();
		} else if (v == moreOperateBT) {// 处理按钮

		} else if (v == ivMailReply) {// 回复邮件
			if (mailInfo != null) {
				Intent intent = new Intent(MailInfoActivity.this, MailActivity.class);
				intent.putExtra("mailInfo", mailInfo);
				intent.putExtra("mailType", 1);
				if (getIntent().getBooleanExtra("sendType", false)) {
					intent.putExtra("isSend", true);
				}
				startActivity(intent);
			}
		} else if (v == showDetail) {// 显示详情

			if ("隐藏".equals(showDetail.getText().toString().trim())) {
				showDetail.setText("显示详情");
				llReceiver.setVisibility(View.GONE);
				llMailcc.setVisibility(View.GONE);
				llMailbcc.setVisibility(View.GONE);
			} else {
				showDetail.setText("隐藏");
				llReceiver.setVisibility(View.VISIBLE);
				llMailcc.setVisibility(View.VISIBLE);
				llMailbcc.setVisibility(View.VISIBLE);
			}
		} else if (v == ivMailReplyAll) {// 回复所有邮件
			if (mailInfo != null) {
				Intent intent = new Intent(MailInfoActivity.this, MailActivity.class);
				intent.putExtra("mailInfo", mailInfo);
				intent.putExtra("mailType", 2);
				if (getIntent().getBooleanExtra("sendType", false)) {
					intent.putExtra("isSend", true);
				}
				startActivity(intent);
			}
		} else if (v == fujianItem) {// 显示附件
			if (fujianContent.isShown()) {
				fujianArrow.setBackgroundResource(R.drawable.arrow_down_blue);
				fujianContent.setVisibility(View.GONE);
			} else {
				fujianArrow.setBackgroundResource(R.drawable.arrow_up_blue);
				fujianContent.setVisibility(View.VISIBLE);
			}
		} else if (v == ivMailDelete) {// 删除邮件
			AlertDialog.Builder dialog = new AlertDialog.Builder(MailInfoActivity.this).setTitle("删除提示").setMessage("确定删除选中邮件")
					.setPositiveButton("确定", new DialogInterface.OnClickListener() {
						@Override
						public void onClick(DialogInterface dialogInterface, int which) {
							if (getIntent().getBooleanExtra("sendType", false)) {
								DBHandler dbHander = new DBHandler(MailInfoActivity.this);
								ArrayList<Long> times = new ArrayList<Long>();
								times.add(mailInfo.timeMillis);
								dbHander.deleteSendMail(times);
								Toast.makeText(MailInfoActivity.this, "删除成功", Toast.LENGTH_SHORT).show();
								Intent intent = new Intent();
								intent.putExtra("timeMillis", mailInfo.timeMillis);
								MailInfoActivity.this.setResult(RESULT_OK, intent);
								finish();
							} else {
								HashMap<String, String> map = new HashMap<String, String>();
								map.put("invoke", "deleteMail");
								map.put("userCode", MailApplication.userCode);
								map.put("password", MailApplication.passWord);
								map.put("mailIds", mailInfo.mailId);
								new HttpManage(MailInfoActivity.this, MailInfoActivity.this, map, 5);
								MailInfoActivity.this.dialog = Utils.createProgressDialog(MailInfoActivity.this,
										Utils.getLoadingMessage(MailInfoActivity.this, "删除邮件..."));
								MailInfoActivity.this.dialog.show();
							}
							dialogInterface.dismiss();
						}
					}).setNegativeButton("取消", new DialogInterface.OnClickListener() {
						@Override
						public void onClick(DialogInterface dialog, int which) {
							dialog.dismiss();
						}
					});
			dialog.show();

			// markLayout.setVisibility(View.GONE);
			// menuLayout.setVisibility(View.GONE);
		} else if (v == ivMailTransmit) {
			if (mailInfo != null) {
				Intent intent = new Intent(MailInfoActivity.this, MailActivity.class);
				intent.putExtra("mailInfo", mailInfo);
				intent.putExtra("mailType", 3);
				if (getIntent().getBooleanExtra("sendType", false)) {
					intent.putExtra("isSend", true);
				}
				startActivity(intent);
			}
		} else if (v == zoomDownIv) {
			if (content != null && !WebSettings.TextSize.NORMAL.name().equals(content.getSettings().getTextSize().name())) {
				String textSize = content.getSettings().getTextSize().name();
				String contentStr = mailInfo.plainContent;
				if (mailInfo.preContent != null && !"".equals(mailInfo.preContent)) {
					contentStr += "</br></p>" + mailInfo.preContent;
				}
				content = new MessageWebView(MailInfoActivity.this);
				content.setTag("webview");
				LinearLayout.LayoutParams ll = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
				contentLayout.removeAllViews();
				contentLayout.addView(content, ll);
				content.getSettings().setJavaScriptEnabled(true);
				content.getSettings().setDefaultTextEncodingName("UTF-8");
				content.getSettings().setLayoutAlgorithm(LayoutAlgorithm.NARROW_COLUMNS);
				content.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
				// content.getSettings().setUseWideViewPort(true);
				// content.getSettings().setLoadWithOverviewMode(true);
				if (WebSettings.TextSize.LARGEST.name().equals(textSize)) {
					content.getSettings().setTextSize(WebSettings.TextSize.LARGER);
				} else {
					content.getSettings().setTextSize(WebSettings.TextSize.NORMAL);
				}
				// content.loadDataWithBaseURL("about:blank", contentStr,
				// "text/html", "UTF-8", null);
				content.setText(contentStr + "</br></br>");
				handler.postDelayed(wvr, 100);
			}

		} else if (v == zoomUpIv) {
			if (content != null && !WebSettings.TextSize.LARGEST.name().equals(content.getSettings().getTextSize().name())) {
				String textSize = content.getSettings().getTextSize().name();
				String contentStr = mailInfo.plainContent;
				if (mailInfo.preContent != null && !"".equals(mailInfo.preContent)) {
					contentStr += "</br></p>" + mailInfo.preContent;
				}
				content = new MessageWebView(MailInfoActivity.this);
				content.setTag("webview");
				LinearLayout.LayoutParams ll = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
				contentLayout.removeAllViews();
				contentLayout.addView(content, ll);
				content.getSettings().setJavaScriptEnabled(true);
				content.getSettings().setDefaultTextEncodingName("UTF-8");
				content.getSettings().setLayoutAlgorithm(LayoutAlgorithm.NARROW_COLUMNS);
				content.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
				// content.getSettings().setUseWideViewPort(true);
				// content.getSettings().setLoadWithOverviewMode(true);
				if (WebSettings.TextSize.NORMAL.name().equals(textSize)) {
					content.getSettings().setTextSize(WebSettings.TextSize.LARGER);
				} else {
					content.getSettings().setTextSize(WebSettings.TextSize.LARGEST);
				}
				// content.loadDataWithBaseURL("about:blank", contentStr,
				// "text/html", "UTF-8", null);
				content.setText(contentStr + "</br></br>");
				handler.postDelayed(wvr, 100);
			}
		}

	}

	private void getFujianInfo(String fileName) {
		HashMap<String, String> map = new HashMap<String, String>();
		map.put("invoke", "showAttach");
		map.put("userCode", MailApplication.userCode);
		map.put("password", MailApplication.passWord);
		map.put("mailId", mailInfo.mailId);
		map.put("fileName", fileName);
		new HttpManage(this, this, map, 2);
		dialog = Utils.createProgressDialog(this, Utils.getLoadingMessage(MailInfoActivity.this, "附件下载..."));
		dialog.show();
	}

	@Override
	public void action(int actionCode, String resultStr, int httpFlag) {
		switch (actionCode) {
		case HttpRequestListener.EVENT_GET_DATA_SUCCESS:
			switch (httpFlag) {
			case 1:
				try {
					Log.i("lgs", "" + resultStr);
					Message moreMeg = handler.obtainMessage(UIEventListener.EVENT_GET_DATA_SUCCESS, ParserRequest.ParsMailInfo(resultStr));
					moreMeg.sendToTarget();
				} catch (Exception e) {
					e.printStackTrace();
					Message moreMeg = handler.obtainMessage(UIEventListener.EVENT_GET_DATA_FAILURE, "返回信息错误");
					moreMeg.sendToTarget();
				}
				break;
			case 2:
				try {
					Log.i("lgs", "" + resultStr);
					Message moreMeg = handler.obtainMessage(24, ParserRequest.ParsFujianInfo(resultStr));
					moreMeg.sendToTarget();
				} catch (Exception e) {
					e.printStackTrace();
					Message moreMeg = handler.obtainMessage(UIEventListener.EVENT_GET_DATA_FAILURE, "返回信息错误");
					moreMeg.sendToTarget();
				}
				break;
			case 5:
				try {
					HashMap<String, Object> map = ParserRequest.ParsSendMail(resultStr);
					Message moreMeg = handler.obtainMessage(UIEventListener.EVENT_DELETE_RECEIVE_MAIL_SUCCESS, map);
					moreMeg.sendToTarget();
				} catch (Exception e) {
					e.printStackTrace();
					Message moreMeg = handler.obtainMessage(UIEventListener.EVENT_DELETE_RECEIVE_MAIL_FAILURE, "返回信息错误");
					moreMeg.sendToTarget();
				}
				break;
			}
			break;
		case HttpRequestListener.EVENT_GET_DATA_FAIL:
			Message moreMeg = handler.obtainMessage(UIEventListener.EVENT_GET_DATA_FAILURE, "网络请求失败");
			moreMeg.sendToTarget();
			break;
		}

	}

	@Override
	protected void onDestroy() {
		super.onDestroy();
		handler.removeCallbacks(wvr);
		handler.removeCallbacks(wvrin);
	}

	private Runnable wvr = new Runnable() {

		@Override
		public void run() {
			// if (content != null) {
			// boolean ret = content.zoomIn();
			// Toast.makeText(getApplicationContext(), "zoomIn=" + ret, 0)
			// .show();
			// if (ret) {
			// handler.postDelayed(wvrin, 1000);
			// } else {
			// handler.postDelayed(wvr, 1000);
			// }
			//
			// }
		}
	};
	private Runnable wvrin = new Runnable() {

		@Override
		public void run() {
			// if (content != null) {
			// boolean ret = content.zoomOut();
			// Toast.makeText(getApplicationContext(), "zoomOut=" + ret, 0)
			// .show();
			// if (!ret) {
			// handler.postDelayed(wvrin, 1000);
			// }
			// }
		}
	};
}
